﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enter.Mvc.Base.Common;
using System.Web.Mvc;
using Enter.Common;

namespace Enter.Mvc.Base.Controllers
{
    public class BaseControllers : Controller
    {


        public BaseControllers()
        {
        }


        #region WebConfig 配置

        /// <summary>
        /// 根据AppSettings Key得到值
        /// </summary>
        /// <typeparam name="T">数据类型</typeparam>
        /// <param name="key">KEY</param>
        /// <returns></returns>
        public static T ConfigByAppSettings<T>(string key)
        {
            return ConfigurationHelp.GetAppSettings<T>(key);
        }
        #endregion

        #region WebRequest

        public T RequestTo<T>(string key)
        {
            object obj = Request[key];
            return obj.To<T>();
        }


        #endregion

    }
}
